

<%@page import="cs4280.dao.MovieDAO"%>
<%--
    Document   : index
    Created on : 2011-3-22, 11:19:34
    Author     : PangPei
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList, java.util.Iterator, cs4280.bean.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />

        <title>Web Movie System</title>

        <meta name="keywords" content="" />

        <meta name="description" content="" />

        <link href="default.css" rel="stylesheet" type="text/css" />

        <script type="text/javascript" src="jquery/jquery-1.4.2.min.js"></script>

        <script type="text/javascript" src="jquery/jquery.slidertron-0.1.js"></script>

        <style type="text/css">

            @import "gallery.css";

        </style>
        <script type="text/javascript">
            function viewMovie(id) {
                document.getElementById("frmPage"+id).movieid.value=id;
                document.getElementById("frmPage"+id).submit();
            }

        function searchMovie() {
            if (document.getElementById("keyword").value.length>0)
                document.getElementById("searchM").submit();
            else
                alert("Please input the keyword to search");

        }
        </script>
        <script type="text/javascript">
        function doAddMessage() {
            if(document.getElementById("msgcontent").value==""){
                alert("The content cannot be empty.");
                return false;
            }
            else if(document.getElementById("email").value=="") {
                alert("Please leave your email..");
                return false;
            }
            else
            {
                return true;
            }
                
        }
        </script>

        <style type="text/css">
            form#sortM label { margin-left: 10px; font-weight: bold; }
            form#sortM #sort { float: right; margin-right: 5px;}
        </style>
    </head>

    <body>
        <form name="frmPage" id="frmPage" method="post" action="<jsp:expression>(String) request.getAttribute("javax.servlet.forward.request_uri")</jsp:expression>">
            <input type="hidden" name="todo" id="todo" value="" />
            <input type="hidden" name="movieid" id="movieid" value="" />
        </form>
        <div id="wrapper">

            <div id="header">

                <div id="logo">

                    <h1><a href="#">webmoive </a></h1>

                    <h2><a href="http://www.freecsstemplates.org/">By Phoena and Yvonne</a></h2>

                </div>

                <!-- end div#logo -->

                <div id="menu">



                    <ul>

                        <form name="homepage" id="homepage" method="post" action="/assignmentCinema/">
                            <li><a onclick="homepage.submit();" >Homepage</a></li>
                        </form>
                        <form name="movie" id="movie" method="post" action="movieControl.do">
                            <li><a onclick="movie.submit();" >Movies</a></li>
                        </form>

                        <li class="active"><a href="#">Discuss</a></li>

                        <form name="manage" id="manage" method="post" action="memberControl.do">
                            <li><a onclick="manage.submit();">Manage</a></li>
                        </form>
                    </ul>



                </div>

                <!-- end div#menu -->

            </div>
        </div>

        <div>

            <div id="page">

                <div id="page-bgtop">

                    <div id="content">

                        <div id="gallery-bg">

                            <div id="gallery-bgtop">

                                <div id="gallery-bgbtm">

                                    <div id="foobar">

                                        <div class="navigation"> <a href="#" class="first">[ &lt;&lt; ]</a> &nbsp; <a href="#" class="previous">[ &lt; ]</a> &nbsp; <a href="#" class="next">[ &gt; ]</a> &nbsp; <a href="#" class="last">[ &gt;&gt; ]</a> </div>

                                        <div class="viewer">

                                            <div class="reel">

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                            </div>

                                        </div>

                                    </div>

                                    <script type="text/javascript">



                                    $('#foobar').slidertron({

                                        viewerSelector:			'.viewer',

                                        reelSelector:			'.viewer .reel',

                                        slidesSelector:			'.viewer .reel .slide',

                                        navPreviousSelector:	'.previous',

                                        navNextSelector:		'.next',

                                        navFirstSelector:		'.first',

                                        navLastSelector:		'.last'

                                    });



                                    </script>

                                    <!-- end -->

                                </div>

                            </div>

                        </div>

                        <jsp:useBean id="member" type="cs4280.bean.Member" scope="session" />
                        <div class="post">
                            <div class="post-bgtop">
                                <div class="post-bgbtm">
                                    <div class="entry" >
                                        <form  name="frmPage" id="frmPage" method="post" onsubmit="return doAddMessage()" action="<jsp:expression>(String) request.getAttribute("javax.servlet.forward.request_uri")</jsp:expression>">
                                            <input type="hidden" name="todo" id="todo" value="addMessage" />
                                            <input type="hidden" name="username" id="username" value="<%=member.getUsername()%>" />
                                            <h2>Leave your message here:</h2>
                                            <table  width="498" border="0" align="center">
                                                <tbody>
                                                    <tr>
                                                        <td valign="top"><div align="center">Name：</div></td>
                                                        <td>

                                                            <span><%=member.getUsername()%></span>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td valign="middle"> <div align="center">Content:</div></td>
                                                        <td><textarea name="msgcontent" cols="60" rows="6" id="msgcontent"></textarea></td>
                                                    </tr>

                                                    <tr>
                                                        <td valign="top"><div align="center">Email</div></td>
                                                        <td> <input name="email" type="text" id="email"> </td>
                                                    </tr></tbody>

                                            </table>
                                            <input type="submit" class="more" value="Submit" />

                                            <input type="reset" class="view" value="Reset" />

                                            <br/>
                                            <br/>






                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <%

                                    ArrayList<Message> messages =
                                            (ArrayList<Message>) request.getAttribute("messages");
                                    Iterator<Message> it = messages.iterator();
                                    while (it.hasNext() != false) {
                                        pageContext.setAttribute("message", (Message) it.next());
                        %>
                        <jsp:useBean id="message" type="cs4280.bean.Message" scope="page"/>
                        <div class="post">
                            <div class="post-bgtop">
                                <div class="post-bgbtm">
                                    <div class="entry">
                                        <form name="frmPage" id="frmPage<%=message.getId()%>" method="post" action="<jsp:expression>(String) request.getAttribute("javax.servlet.forward.request_uri")</jsp:expression>">
                                            <input type="hidden" name="todo" id="todo" value="deleteMessage" />
                                            <input type="hidden" name="messageid" id="messageid" value="<%=message.getId()%>" />
                                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td>Time: <%=message.getTime()%></td>
                                                    <td> <div align="center"><a href="mailto:<%=message.getEmail()%>"><img src="images/Mail-icon.png" alt="<%=message.getEmail()%>" border="0" align="absmiddle"/></a>Email:Contact Me</div></td>

                                                    <% if (member.getUsername().equalsIgnoreCase(message.getName()) || member.getRole().equalsIgnoreCase("manager")) {
                                                    %>
                                                    <td><input type="submit" class="more" value="Delete" /></td>
                                                        <%                          }
                                                        %>
                                                </tr>
                                                <tr>
                                                    <td >
                                                        From：<%=message.getName()%>
                                                    </td>

                                                </tr>
                                                <tr>

                                                    <td >
                                                        Message: <%=message.getContent()%>
                                                    </td>
                                                </tr>
                                            </table>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <%}
                        %>

                    </div>

                    <!-- end div#content -->

                    <div id="sidebar">

                        <div id="sidebar-bgtop">

                            <div id="sidebar-bgbtm">

                                <ul>

                                    <li id="login">

                                        <h2>User Login</h2>

                                        <jsp:include page="/WEB-INF/jsp/user.jsp"/>


                                    </li>

                                    <li>

                                        <h2>Lorem Ipsum</h2>

                                        <ul>

                                            <li><a href="#">Fusce dui neque fringilla</a></li>

                                            <li><a href="#">Eget tempor eget nonummy</a></li>

                                            <li><a href="#">Magna lacus bibendum mauris</a></li>

                                            <li><a href="#">Nec metus sed donec</a></li>

                                            <li><a href="#">Magna lacus bibendum mauris</a></li>

                                            <li><a href="#">Velit semper nisi molestie</a></li>

                                            <li><a href="#">Eget tempor eget nonummy</a></li>

                                        </ul>

                                    </li>

                                    <li>

                                        <h2>Volutpat Dolore</h2>

                                        <ul>

                                            <li><a href="#">Nec metus sed donec</a></li>

                                            <li><a href="#">Magna lacus bibendum mauris</a></li>

                                            <li><a href="#">Velit semper nisi molestie</a></li>

                                            <li><a href="#">Eget tempor eget nonummy</a></li>

                                            <li><a href="#">Nec metus sed donec</a></li>

                                            <li><a href="#">Magna lacus bibendum mauris</a></li>

                                            <li><a href="#">Velit semper nisi molestie</a></li>

                                        </ul>

                                    </li>

                                    <li>

                                        <h2>Bebindum Mauris </h2>

                                        <ul>

                                            <li><a href="#">Nec metus sed donec</a></li>

                                            <li><a href="#">Magna lacus bibendum mauris</a></li>

                                            <li><a href="#">Velit semper nisi molestie</a></li>

                                            <li><a href="#">Eget tempor eget nonummy</a></li>

                                            <li><a href="#">Nec metus sed donec</a></li>

                                            <li><a href="#">Velit semper nisi molestie</a></li>

                                        </ul>

                                    </li>

                                    <li>

                                        <h2>Phasellus Tellus</h2>

                                        <ul>

                                            <li><a href="#">Eget tempor eget nonummy</a></li>

                                            <li><a href="#">Nec metus sed donec</a></li>

                                            <li><a href="#">Magna lacus bibendum mauris</a></li>

                                            <li><a href="#">Velit semper nisi molestie</a></li>

                                        </ul>

                                    </li>

                                </ul>

                            </div>

                        </div>

                    </div>

                    <!-- end div#sidebar -->

                    <div style="clear: both; height: 1px"></div>

                </div>

            </div>

            <!-- end div#page -->

        </div>

        <!-- end div#wrapper -->

        <div id="footer-wrapper">

            <div id="footer">

                <p id="legal">Copyright &copy; 2007 Vertebrate . All Rights Reserved. Designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>

                <p id="links"><a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a></p>

            </div>

        </div>

        <!-- end div#footer -->

    </body>

</html>
